home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_cap_corrosion.cog < prev    next >
Text File  |  1998-09-17  |  2KB  |  90 lines

  1. # DroidWorks
  2. # Corrosion capability cog
  3. #
  4. # Corrosion ability is in inventory bin 12
  5. # Power is in inventory bin 20
  6.  
  7.  
  8. symbols
  9.  
  10. thing    player
  11. int        effectHandle=-1
  12.  
  13. message    activated
  14. message    pulse
  15. message    shutdown
  16.  
  17. sound    goggleActivate=NRGt8InfraOn.wav
  18. sound    goggleDeactivate=NRGt8InfraOff.wav
  19.  
  20. end
  21.  
  22. # ========================================================================================
  23.  
  24. code
  25.  
  26. shutdown:
  27.     if(effectHandle!=-1)
  28.         freeColorEffect(effectHandle);
  29.     return;
  30.  
  31. activated:
  32.     player = GetSourceRef();
  33.  
  34.     if(GetInv(player, 12))
  35.     {
  36.         if(IsInvActivated(player, 12) == 0)
  37.         {
  38.             if(GetInv(player, 20) > 0)
  39.             {
  40.                 # Print("Infrared activated");
  41.                 SetInvActivated(player, 12, 1);
  42.                 PlaySoundThing(goggleActivate, player, 1.0, -1, -1, 0x80);
  43.                 effectHandle = newColorEffect(1, 0, 0, 0, 0, 0, 0, 0, 0, 1.0);
  44.                 EnableIRMode(0.3, 1);
  45.                 SetPulse(1.5);
  46.             }
  47.             else
  48.             {
  49.                 # Print("No power for Infrared");
  50.                 PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
  51.             }
  52.         }
  53.         else
  54.         {
  55.             # Print("Infrared deactivated");
  56.             SetInvActivated(player, 12, 0);
  57.             DisableIRMode();
  58.             PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
  59.             if(effectHandle!=-1)
  60.             {
  61.                 freeColorEffect(effectHandle);
  62.                 effectHandle = -1;
  63.             }
  64.             SetPulse(0);
  65.         }
  66.     }
  67.     return;
  68.  
  69. # ........................................................................................
  70.  
  71. pulse:
  72.     ChangeInv(player, 20, -5);
  73.  
  74.     if(GetInv(player, 20) == 0)
  75.     {
  76.         # Print("No power for Infrared");
  77.         SetInvActivated(player, 12, 0);
  78.         PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
  79.         DisableIRMode();
  80.         if(effectHandle!=-1)
  81.         {
  82.             freeColorEffect(effectHandle);
  83.             effectHandle = -1;
  84.         }
  85.         SetPulse(0);
  86.     }
  87.     return;
  88.  
  89. end
  90.